home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Misc. Utilities / Installer / Installer 3.2 / Samples - Installer 3.2 / InstallDA.r < prev    next >
Encoding:
Text File  |  1992-01-22  |  8.9 KB  |  234 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: installing a desk accessory into the appropriate place
  6.  *
  7.  *    File:        InstallDA.r -    Rez Source
  8.  *
  9.  *    by:            Jon Zap
  10.  *
  11.  *    Copyright © 1991 Apple Computer, Inc.
  12.  *    All rights reserved.
  13.  *
  14.  *------------------------------------------------------------------------------
  15.  * This sample installs "TheDA" into the appropriate place: the system file if we
  16.  * are pre 7.0 or into the Apple Menu Items folder if we are 7.0 or later.
  17.  * It allows for custom installation/removal.
  18.  * We use the gestalt findfolder attributes to determine whether or not the Apple
  19.  * Menu Items folder exists (assuming that there is a correlation between this
  20.  * trap and the folder).  The custom installation makes this difference explicit.
  21.  * Notes of interest:  if we are installing a DA into the system file (pre 7.0)
  22.  * then we merely use an 'inra' that specifies the 'DRVR' resource in a suitcase
  23.  * file by name, the DA's owned resources are handled by the installer
  24.  *----------------------------------------------------------------------------*/
  25.  
  26. #include "Types.r"                    /* for the ICON resource */
  27. #include "InstallerTypes.r"
  28.  
  29. /* You can build and complete the script with the following lines:
  30. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  31. # or set up folders with the same names and contents as the floppies
  32. # put these folders in the same folder as the script or at the root directory of same disk
  33.  
  34.     rez -o "InstallDA" -t 'bjbc' -c 'bjbc' "InstallDA.r"
  35.     setfile -a i "InstallDA"        #mark Inited
  36.     scriptcheck -p "InstallDA"
  37. */
  38.  
  39. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  40. #define kScriptCheckSetsDate    0x01
  41.  
  42. /* Definitions for the rules */
  43. #define rule7                1000
  44. #define rule6                1001
  45.  
  46. /* Defines for the file spec atoms.  These are specifications for source and destination files */
  47. #define fsSourceDA7            2000
  48. #define fsSourceDA6            2001
  49. #define fsTargetDA7            2002
  50. #define fsTargetSystem        2003
  51.  
  52. /* This is the name of the source disk */
  53. #define DADisk "DA Disk:"
  54.  
  55. /* where we want to install our DA. */
  56. #define TargetPath7    "special-amnu:"
  57. #define TargetPath6 "special-macs:"
  58.  
  59. /* Definition for the package. */
  60. #define pkTheDA7            3000
  61. #define pkTheDA6            3001
  62.  
  63. /* Definition for the file atom */
  64. #define faDA7                4000
  65.  
  66. /* definition for the resource atom */
  67. #define raDA6                5000
  68.  
  69. /* Definition for the package comment resource */
  70. #define cmtTheDA            6000
  71. #define iconTheDA            7000
  72.  
  73. /* December 10, 1990 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  74. /* this value to a LongInt seconds value needed by the Installer. */
  75. #define currentReleaseDate    12101990        
  76. #define currentVersion        100     /* Version 1.0 goes in the 'icmt' rsrc */
  77.  
  78. /* Gestalt definitions taken from the Gestalt.h file for use in the CheckGestalt clause */
  79. #define gestaltFindFolderAttr 'fold'        /* Folder Mgr attributes */
  80.  
  81.  
  82. /************************** Easy Install Rule resources **********************************/
  83. resource 'infr' (1) {
  84.     format0  {{
  85.         pickFirst,    {rule7, rule6},     /* Select the first rule */
  86.     }};
  87. };
  88.  
  89. /* note the '.' in the first rule is missing in the 2nd rule so we can differentiate*/
  90. resource 'inrl' (rule7) {
  91.     format0 {{
  92.         checkGestalt { gestaltFindFolderAttr, {1} },
  93.         addUserDescription {"Key Caps(System 7.0)\n"},    /* message to appear in Easy Install screen */
  94.         addPackages {{pkTheDA7}}            /* we're installing the DA */
  95.     }};
  96. };
  97. resource 'inrl' (rule6) {
  98.     format0 {{
  99.         addUserDescription {"Key Caps(System 6.0)\n"},    /* message to appear in Easy Install screen */
  100.         addPackages {{pkTheDA6}}            /* we're installing the DA */
  101.     }};
  102. };
  103.  
  104. /***************************** Package Resources ************************************************/
  105. resource 'inpk' (pkTheDA7) {
  106.     format0 {
  107.         showsOnCustom,                     /* Package appears in the Custom Install display */
  108.         removable,                        /* Package can be removed */
  109.         dontForceRestart,                /* not necessary to reboot in this case */
  110.         cmtTheDA,                         /* package's 'icmt' resource id */
  111.         0,                                /* Package size (filled in by ScriptCheck) */
  112.         "TheDA -> Apple Menu folder (System 7.0)", { /* package name for package that shows on custom */
  113.             'infa', faDA7;
  114.         }
  115.     }
  116. };
  117.  
  118. resource 'inpk' (pkTheDA6) {
  119.     format0 {
  120.         showsOnCustom,                 /* Package appears in the Custom Install display */
  121.         removable,                    /* Package can be removed */
  122.         forceRestart,                /* major mod to system file, force reboot on live install */
  123.         cmtTheDA,                     /* package's 'icmt' resource id */
  124.         0,                            /* Package size (filled in by ScriptCheck) */
  125.         "TheDA -> system file (Pre System 7.0)", { /* package name for package that shows on custom */
  126.             'inra', raDA6;
  127.         }
  128.     }
  129. };
  130.  
  131. /***************************** Comments ************************************************/
  132. resource 'icmt' (cmtTheDA) {
  133.     currentReleaseDate,
  134.     currentVersion,
  135.     iconTheDA,
  136.     "This package contains TheDA. "
  137. };
  138.  
  139. resource 'ICON' (iconTheDA) {
  140.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  141.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  142.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  143.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  144.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  145.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  146.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  147.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  148. };
  149.  
  150.  
  151.  
  152. /********************************************* File Specs *******************************************/
  153. /* Source File Specs */
  154. resource 'infs' (fsSourceDA7) {
  155.     'dfil',                                /* File Type */
  156.     'keyc',                                /* Creator */
  157.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  158.     noSearchForFile,                    /* Do not search the source disk for the file */
  159.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  160.     DADisk"Key Caps 7.0"                /* Path to the file */
  161. };
  162.  
  163. resource 'infs' (fsSourceDA6) {
  164.     'DFIL',                                /* File Type */
  165.     'DMOV',                                /* Creator */
  166.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  167.     noSearchForFile,                    /* Do not search the source disk for the file */
  168.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  169.     DADisk"Key Caps 6.0"                    /* Path to the file */
  170. };
  171.  
  172. /* Target File Specs */
  173. resource 'infs' (fsTargetDA7) {
  174.     'dfil',                                /* File Type */
  175.     'keyc',                                /* Creator */
  176.     0,                                    /* creation date not needed for target file specs */
  177.     noSearchForFile,                    /* Do not search the target disk for the file */
  178.     typeCrMustMatch,                    /* not needed for target file specs */
  179.     TargetPath7"Key Caps"                /* destination Path */
  180. };
  181.  
  182. resource 'infs' (fsTargetSystem) {
  183.     'ZSYS',                                /* File Type */
  184.     'MACS',                                /* Creator */
  185.     0,                                    /* creation date not needed for target file specs */
  186.     noSearchForFile,                    /* Do not search the target disk for the file */
  187.     typeCrNeedNotMatch,                    /* not needed for target file specs */
  188.     TargetPath6"System"                    /* destination Path */
  189. };
  190.  
  191. /******************************************** File Atoms ************************************************/
  192. resource 'infa' (faDA7) {
  193.     format0 {
  194.         deleteWhenRemoving,                /* Delete the file if remove (option-custom) is clicked    */
  195.         dontDeleteWhenInstalling,         /* dont need to delete the target before copying new one */
  196.         copy,                             /* Copy the file to the destination */
  197.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  198.         updateExisting,                 /* replace an existing copy if mine is newer */
  199.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  200.         rsrcFork, dataFork,                /* Copy both forks of the file */
  201.         fsTargetDA7,                    /* TARGET file spec for this file */
  202.         fsSourceDA7,                     /* SOURCE file spec for this file */
  203.         0,                                /* atom size (filled in by ScriptCheck) */
  204.         ""                                /* Atom Description (Installer will use file name) */
  205.     };
  206. };
  207.  
  208. /******************************************** Resource Atoms **********************************************/
  209. resource 'inra' (raDA6) {
  210.     format0 {
  211.         deleteWhenRemoving,                /* Delete the resource if remove (option-custom) is clicked    */
  212.         dontDeleteWhenInstalling,         /* dont need to delete the target before copying new one */
  213.         copy,                             /* Copy rsrc to destination */
  214.         tgtRequired,                     /* Target file need already exist on dest to install */
  215.         updateExisting,                 /* replace any preexisting DA with the same name */
  216.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  217.         ignoreProtection,                /* Do it even if the target rsrc is protected */
  218.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  219.         byName,                            /* use the name to find the source and target rsrc */
  220.         nameMustMatch,                    /* this field is ignored if above is byName */
  221.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  222.         fsSourceDA6,                    /* Source file spec where to get rsrc */
  223.         'DRVR',                            /* Resource type */
  224.         0,                                 /* Resource source id */
  225.         0,                                /* Resource target id */
  226.         0,                                /* atom size (filled in by ScriptCheck) */
  227.         "Desk Accessory: Key Caps",        /* Atom description */                            
  228.         "\0x00Key Caps"                    /* Resource name */
  229.     };
  230. };
  231.  
  232.  
  233.  
  234.